In [1]:
import numpy as np
import pandas as pd
import math
import cmath
from scipy.optimize import root
from scipy.integrate import odeint
from __future__ import division
from scipy import *
from pylab import *
import matplotlib.pyplot as plt
%matplotlib inline

In [47]:
xo = 0.5
xk = 0.3
gamma = 0.8
A = 2
yr = 0.1 #kg kgCO2 −1

#tao = np.linspace(0,5)
#print(tao)
#print(np.shape(tao), type(tao))

In [4]:
tao1 = (xo - xk) / (gamma * A * yr) 
tao1


Out[4]:
1.2499999999999998

In [5]:
tao2 = tao1 + xk / (gamma * A * yr) * np.log(xk / xo + (1 - xk / xo) * np.exp(xo / xk * A))
tao2


Out[5]:
5.8796956017132089

In [6]:
def concentracion(tao):
    
    if tao == 1:
        x = x0 - gamma * A * yr * tao * exp(-A*z)
        return x
    if tao == 2:
        x = x0 - (xo - xk) * exp(-A * (z - zk))
        return x
    if tao == 3:
        x = x0 / (1 + ((xo/xk) * exp(gamma * A * yr / xk * (tao - tao1)) - 1) * exp(-xo/xk * A*z))
        return x

In [7]:
zk = xk / (A * xo) * np.log((xo * np.exp(gamma * A * yr / xk * (tao - tao1)) - xk) / (xo - xk))
zk


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-7-5ea8c1465211> in <module>()
----> 1 zk = xk / (A * xo) * np.log((xo * np.exp(gamma * A * yr / xk * (tao - tao1)) - xk) / (xo - xk))
      2 zk

NameError: name 'tao' is not defined

In [8]:
tao2 = tao1 + xk / (gamma * A * yr) * np.log(xk / xo + (1 - xk / xo) * np.exp(xo / xk * A))
tao2


Out[8]:
5.8796956017132089

In [9]:
e = gamma * yr* tao * (1- np.exp(-A))
np.shape(e)
type(e)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-9-f96611aa44ec> in <module>()
----> 1 e = gamma * yr* tao * (1- np.exp(-A))
      2 np.shape(e)
      3 type(e)

NameError: name 'tao' is not defined

In [14]:
plt.plot(tao, e)


Out[14]:
[<matplotlib.lines.Line2D at 0x7fb4cc930eb8>]

In [15]:
e = gamma * yr* (tao - tao1 * np.exp(-A * (1 - zk)))

In [17]:
e = xo - xk / A * np.log(1 + xk / xo * (np.exp(xo / xk * A) - 1)) * np.exp(gamma * A * yr / xk * (tao1 - tao))

In [48]:
def rendimiento(tao):
    if tao <= tao1 and tao < tao2:
        e = gamma * yr* tao * (1- np.exp(- A))
        print("tao < tao1 and tao < tao2")
        return e
    if tao > tao1 and tao <= tao2:
        zk = xk / (A * xo) * np.log((xo * np.exp(gamma * A * yr / xk * (tao - tao1)) - xk) / (xo - xk))
        e = gamma * yr * (tao - tao1 * np.exp(- A * (1 - zk)))
        print("tao >= tao1 and tao < tao2")
        return e
    if tao > tao2:
        e = xo - xk / A * np.log(1 + xk / xo * (np.exp(xo / xk * A) - 1) * np.exp(gamma * A * yr / xk * (tao1 - tao)))
        print("tao >= tao2")
        return e

In [50]:
tao = 9
print("tao1 = {} tao2 = {}".format(tao1, tao2))
rendimiento(tao)


tao1 = 1.2499999999999998 tao2 = 5.879695601713209
tao >= tao2
Out[50]:
0.46533565099574969

In [51]:
ttao = [i for i in range(5)]
ttao


Out[51]:
[0, 1, 2, 3, 4]

In [52]:
ttao = [i for i in np.linspace(0,5)]
ttao


Out[52]:
[0.0,
 0.10204081632653061,
 0.20408163265306123,
 0.30612244897959184,
 0.40816326530612246,
 0.51020408163265307,
 0.61224489795918369,
 0.7142857142857143,
 0.81632653061224492,
 0.91836734693877553,
 1.0204081632653061,
 1.1224489795918369,
 1.2244897959183674,
 1.3265306122448979,
 1.4285714285714286,
 1.5306122448979593,
 1.6326530612244898,
 1.7346938775510203,
 1.8367346938775511,
 1.9387755102040818,
 2.0408163265306123,
 2.1428571428571428,
 2.2448979591836737,
 2.3469387755102042,
 2.4489795918367347,
 2.5510204081632653,
 2.6530612244897958,
 2.7551020408163267,
 2.8571428571428572,
 2.9591836734693877,
 3.0612244897959187,
 3.1632653061224492,
 3.2653061224489797,
 3.3673469387755102,
 3.4693877551020407,
 3.5714285714285716,
 3.6734693877551021,
 3.7755102040816326,
 3.8775510204081636,
 3.9795918367346941,
 4.0816326530612246,
 4.1836734693877551,
 4.2857142857142856,
 4.3877551020408161,
 4.4897959183673475,
 4.591836734693878,
 4.6938775510204085,
 4.795918367346939,
 4.8979591836734695,
 5.0]

In [53]:
caso1 = [rendimiento(tao) for tao in np.linspace(0,15)]
caso1


tao < tao1 and tao < tao2
tao < tao1 and tao < tao2
tao < tao1 and tao < tao2
tao < tao1 and tao < tao2
tao < tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao1 and tao < tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
tao >= tao2
Out[53]:
[0.0,
 0.021175462451348267,
 0.042350924902696534,
 0.063526387354044797,
 0.084701849805393067,
 0.10586240724665469,
 0.12693119197306726,
 0.14783738881474864,
 0.1685261464121838,
 0.18894922443715043,
 0.20906060982884964,
 0.22881410899010135,
 0.24816182896433522,
 0.26705309024678237,
 0.28543355559493905,
 0.30324446322126325,
 0.32042190154796807,
 0.33689608714873753,
 0.35259062034949884,
 0.36742169991480716,
 0.38130372981839566,
 0.39419609082205931,
 0.40609012315244303,
 0.41699047089218877,
 0.42691473211076258,
 0.43589255261409354,
 0.44396415365496233,
 0.45117844370314303,
 0.45759089218955901,
 0.46326134405019936,
 0.46825193197286874,
 0.47262520626848792,
 0.47644255912026351,
 0.479762978345391,
 0.48264213103884324,
 0.48513175212947535,
 0.48727929723524216,
 0.48912781199630445,
 0.49071596928965422,
 0.49207822925725819,
 0.49324508303711023,
 0.49424334802607572,
 0.49509648943078877,
 0.49582494917820918,
 0.49644646866322384,
 0.49697639621796236,
 0.49742797363639818,
 0.4978125986875685,
 0.49814006243866604,
 0.49841876152514436]

In [54]:
caso1


Out[54]:
[0.0,
 0.021175462451348267,
 0.042350924902696534,
 0.063526387354044797,
 0.084701849805393067,
 0.10586240724665469,
 0.12693119197306726,
 0.14783738881474864,
 0.1685261464121838,
 0.18894922443715043,
 0.20906060982884964,
 0.22881410899010135,
 0.24816182896433522,
 0.26705309024678237,
 0.28543355559493905,
 0.30324446322126325,
 0.32042190154796807,
 0.33689608714873753,
 0.35259062034949884,
 0.36742169991480716,
 0.38130372981839566,
 0.39419609082205931,
 0.40609012315244303,
 0.41699047089218877,
 0.42691473211076258,
 0.43589255261409354,
 0.44396415365496233,
 0.45117844370314303,
 0.45759089218955901,
 0.46326134405019936,
 0.46825193197286874,
 0.47262520626848792,
 0.47644255912026351,
 0.479762978345391,
 0.48264213103884324,
 0.48513175212947535,
 0.48727929723524216,
 0.48912781199630445,
 0.49071596928965422,
 0.49207822925725819,
 0.49324508303711023,
 0.49424334802607572,
 0.49509648943078877,
 0.49582494917820918,
 0.49644646866322384,
 0.49697639621796236,
 0.49742797363639818,
 0.4978125986875685,
 0.49814006243866604,
 0.49841876152514436]

In [80]:
Tao = np.linspace(0,15)

plt.plot(Tao, caso1)
plt.title("Modelo Lack")
plt.xlabel("$\tau$")
plt.ylabel("Rendimiento e")
#plt.legend(('$xk=0.3$'),loc=0)


Out[80]:
<matplotlib.text.Text at 0x7f9de3186a58>

In [ ]:

$\tau$


In [ ]:


In [ ]:


In [ ]:


In [ ]: